package com.itheima.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.OperatorDao;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.LogEntity;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class OperatorLogServiceImpl implements OperatorLogService {

    @Autowired
    OperatorDao operatorDao;


    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        //1.开始分页
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());
        //2.条件查询
        Page<LogEntity> page = operatorDao.findByCondition(queryPageBean.getQueryString());
        return new PageResult(page.getTotal(),page);
    }
}
